package com.maple.common.utils;

import android.text.TextUtils;

import java.util.List;

public class CheckUtils {
    public static <T> void checkNotNull(T object, String message) {
        if (object == null) {
            throw new NullPointerException(message);
        }
    }

    public static String checkNotEmpty(String object, String message) {
        if (TextUtils.isEmpty(object)) {
            throw new RuntimeException(message);
        }
        return object;
    }

    public static <T> void checkNotEmpty(List<T> object , String message) {
        if (object == null) {
            throw new RuntimeException(message);
        }

        if (object.isEmpty()) {
            throw new RuntimeException(message);
        }
    }

    public static <T> void checkNotEqual(T object, T value, String message) {
        if (object == value) {
            throw new RuntimeException(message);
        }
    }
}